import tensorflow as tf

# 声明一个占位符的变量
var1 = tf.placeholder(dtype=tf.float32)
var2 = tf.placeholder(dtype=tf.float32)

result = tf.subtract(var1, var2)
init = tf.global_variables_initializer()

with tf.Session() as session:
    session.run(init)
    # 为placeholder 变量赋值
    print(session.run(result, {var1: 10.0, var2: 12}))
